/*     */ package tools.packet;
/*     */
/*     */ import client.MapleCharacter;
/*     */ import client.MapleClient;
/*     */ import client.MapleEnumClass;
/*     */ import client.MaplePartTimeJob;
/*     */ import configs.ServerConfig;
/*     */ import constants.JobConstants;
/*     */ import constants.ServerConstants;
/*     */ import handling.ServerType;
/*     */ import handling.login.LoginServer;
/*     */ import handling.opcode.SendPacketOpcode;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ import org.apache.logging.log4j.LogManager;
/*     */ import org.apache.logging.log4j.Logger;
/*     */ import tools.DateUtil;
/*     */ import tools.HexTool;
/*     */ import tools.MaplePacketCreator;
/*     */ import tools.Randomizer;
/*     */ import tools.Triple;
/*     */ import tools.data.output.MaplePacketLittleEndianWriter;
/*     */
/*     */ public class LoginPacket {
    /*  27 */   private static final Logger log = LogManager.getLogger(LoginPacket.class);
    /*     */
    /*     */   public static byte[] getHello(short mapleVersion, byte[] sendIv, byte[] recvIv, ServerType type) {
        log.info("调用getHello");
        /*  39 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /*  41 */     if (ServerConfig.WORLD_SERVER_GETHELLO == 15) {
            /*  42 */       mplew.writeShort(15 + ServerConfig.LOGIN_MAPLE_PATCH.length() - ((type != ServerType.登录服务器) ? 1 : 0));
            /*  43 */       mplew.writeShort(mapleVersion + ((type == ServerType.聊天服务器) ? 159 : 0));
            /*  44 */       mplew.writeMapleAsciiString(ServerConfig.LOGIN_MAPLE_PATCH);
            /*  45 */       mplew.write(recvIv);
            /*  46 */       mplew.write(sendIv);
            /*  47 */       if (type != ServerType.登录服务器) {
                /*  48 */         mplew.write(ServerConfig.LOGIN_MAPLE_TYPE);
                /*     */       } else {
                /*  50 */         mplew.writeShort((short)ServerConfig.LOGIN_MAPLE_TYPE);
                /*     */       }
            /*  52 */       mplew.write(1);
            /*     */     } else {
            /*  54 */       mplew.writeShort(29 + ServerConfig.LOGIN_MAPLE_PATCH.length());
            /*  55 */       mplew.writeShort(mapleVersion);
            /*  56 */       mplew.writeMapleAsciiString(ServerConfig.LOGIN_MAPLE_PATCH);
            /*  57 */       mplew.write(recvIv);
            /*  58 */       mplew.write(sendIv);
            /*  59 */       mplew.write(ServerConfig.LOGIN_MAPLE_TYPE);
            /*  60 */       mplew.write(0);
            /*  62 */       mplew.writeShort(mapleVersion);
            /*  63 */       mplew.writeMapleAsciiString(ServerConfig.LOGIN_MAPLE_PATCH);
            /*  64 */       mplew.write(recvIv);
            /*  65 */       mplew.write(sendIv);
            /*  66 */       mplew.write(ServerConfig.LOGIN_MAPLE_TYPE);
            /*  67 */       mplew.write(0);
            /*     */     }
        /*  85 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getPing(boolean inChannel) {
        log.info("调用getPing");
        /*  94 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(2);
        /*  96 */     mplew.writeShort(SendPacketOpcode.PING.getValue());
        /*  97 */     mplew.writeShort(inChannel ? SendPacketOpcode.PING2.getValue() : SendPacketOpcode.PING.getValue());
        /*  98 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getLoginAUTH() {
        log.info("调用getLoginAUTH");
        /* 107 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 113 */     mplew.writeShort(SendPacketOpcode.LOGIN_AUTH.getValue());
        /* 114 */     int rand = Randomizer.rand(1, 5);
        /* 116 */     (new String[6])[0] = "MapLogin";
        /* 116 */     (new String[6])[1] = "MapLogin1";
        /* 116 */     (new String[6])[2] = "MapLogin2";
        /* 116 */     (new String[6])[3] = "MapLogin3";
        /* 116 */     (new String[6])[4] = "MapLogin4";
        /* 116 */     (new String[6])[5] = "MapLogin5";
        /* 116 */     mplew.writeMapleAsciiString((new String[6])[(int)(Math.random() * 6.0D)]);
        /* 117 */     mplew.writeInt(DateUtil.getTime());
        /* 119 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] addConnection() {
        log.info("调用addConnection");
        /* 123 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 125 */     mplew.writeShort(SendPacketOpcode.CREATING_CONNECTION.getValue());
        /* 126 */     mplew.write(1);
        /* 128 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] licenseResult() {
        /* 136 */     log.trace("调用licenseResult");
        /* 137 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 139 */     mplew.writeShort(SendPacketOpcode.LICENSE_RESULT.getValue());
        /* 140 */     mplew.write(1);
        /* 142 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] genderNeeded(MapleClient c) {
        /* 150 */     log.trace("调用genderNeeded");
        /* 151 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(3);
        /* 153 */     mplew.writeShort(SendPacketOpcode.CHOOSE_GENDER.getValue());
        /* 154 */     mplew.writeMapleAsciiString(c.getAccountName());
        /* 156 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] genderChanged(MapleClient c) {
        /* 164 */     log.trace("调用genderChanged");
        /* 165 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(3);
        /* 167 */     mplew.writeShort(SendPacketOpcode.GENDER_SET.getValue());
        /* 168 */     mplew.write(0);
        /* 169 */     mplew.writeMapleAsciiString(c.getAccountName());
        /* 170 */     mplew.writeMapleAsciiString(String.valueOf(c.getAccID()));
        /* 172 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getLoginFailed(MapleEnumClass.AuthReply reason) {
        log.trace("调用getLoginFailed");
        /* 184 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(16);
        /* 186 */     mplew.writeShort(SendPacketOpcode.LOGIN_STATUS.getValue());
        /* 187 */     mplew.write(reason.getCode());
        /* 188 */     if (reason.getCode() == 84) {
            /* 189 */       mplew.writeLong(PacketHelper.getTime(-2L));
            /* 190 */     } else if (reason.is(MapleEnumClass.AuthReply.GAME_CONNECTING_ACCOUNT)) {
            /* 191 */       mplew.writeZeroBytes(5);
            /*     */     }
        /* 193 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getPermBan(byte reason) {
        /* 197 */     log.trace("调用getPermBan");
        /* 198 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(16);
        /* 200 */     mplew.writeShort(SendPacketOpcode.LOGIN_STATUS.getValue());
        /* 201 */     mplew.writeShort(2);
        /* 202 */     mplew.write(0);
        /* 203 */     mplew.writeShort((short)reason);
        /* 204 */     mplew.write(HexTool.getByteArrayFromHexString("01 01 01 01 00"));
        /* 206 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getTempBan(long timestampTill, byte reason) {
        /* 210 */     log.trace("调用getTempBan");
        /* 211 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(17);
        /* 215 */     mplew.writeShort(SendPacketOpcode.LOGIN_STATUS.getValue());
        /* 216 */     mplew.writeShort(2);
        /* 219 */     mplew.writeLong(135669600000000000L);
        /* 220 */     mplew.writeShort((short)reason);
        /* 221 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getAuthSuccessRequest(MapleClient client) {
        log.info("调用getAuthSuccessRequest");
        /* 231 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 233 */     mplew.writeShort(SendPacketOpcode.LOGIN_STATUS.getValue());
        /* 234 */     mplew.write(0);
        /* 235 */     mplew.writeMapleAsciiString(client.getAccountName());
        /* 236 */     mplew.writeLong(0L);
        /* 237 */     mplew.writeInt(client.getAccID());
        /* 239 */     mplew.writeBool(ServerConfig.LOGIN_DELETECHARACTER);
        /* 241 */     mplew.writeInt(0);
        /* 242 */     mplew.writeInt(0);
        /* 243 */     mplew.write(3);
        /* 244 */     mplew.write(0);
        /* 247 */     mplew.writeLong(DateUtil.getFileTimestamp(System.currentTimeMillis()));
        /* 248 */     mplew.write(0);
        /* 249 */     mplew.writeLong(0L);
        /* 250 */     mplew.writeShort(0);
        /* 251 */     mplew.write(0);
        /* 252 */     mplew.write(0);
        /* 254 */     mplew.writeInt(-1);
        /* 255 */     mplew.writeBool(true);
        /* 256 */     mplew.writeMapleAsciiString("");
        /* 257 */     mplew.writeMapleAsciiString(client.getAccountName());
        /* 258 */     mplew.write(1);
        /* 259 */     mplew.write(1);
        /* 260 */     mplew.writeShort(1);
        /* 262 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getAuthSuccessRequestX(MapleClient client, boolean showWhat) {
        log.info("调用getAuthSuccessRequestX");
        /* 273 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 275 */     mplew.writeShort(SendPacketOpcode.AUTO_LOGIN_STATUS.getValue());
        /* 276 */     mplew.write(0);
        /* 277 */     mplew.writeInt(client.getAccID());
        /* 279 */     mplew.write(0);
        /* 280 */     mplew.write(128);
        /* 281 */     mplew.writeZeroBytes(7);
        /* 282 */     mplew.writeShort(3);
        /* 283 */     mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        /* 284 */     mplew.writeZeroBytes(9);
        /* 285 */     mplew.writeMapleAsciiString(client.getAccountName());
        /* 286 */     mplew.writeShort(0);
        /* 287 */     mplew.write(1);
        /* 288 */     mplew.write(33);
        /* 290 */     for (int i = 0; i < ServerConstants.JOB_NAMELIST.length; i++) {
            /* 291 */       mplew.write(ServerConfig.WORLD_CLOSEJOBS.contains(ServerConstants.JOB_NAMELIST[i]) ? 0 : 1);
            /* 292 */       mplew.writeShort(1);
            /*     */     }
        /* 294 */     mplew.write(0);
        /* 295 */     mplew.writeInt(-1);
        /* 296 */     mplew.writeBool(showWhat);
        /* 298 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] deleteCharResponse(int chrId, int state) {
        /* 302 */     log.trace("调用deleteCharResponse");
        /* 303 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 305 */     mplew.writeShort(SendPacketOpcode.DELETE_CHAR_RESPONSE.getValue());
        /* 306 */     mplew.writeInt(chrId);
        /* 307 */     mplew.write(state);
        /* 309 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] secondPwError(byte mode) {
        /* 313 */     log.trace("调用secondPwError");
        /* 314 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(3);
        /* 320 */     mplew.writeShort(SendPacketOpcode.SECONDPW_ERROR.getValue());
        /* 321 */     mplew.write(mode);
        /* 323 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] enableRecommended(List<Triple<String, Integer, Boolean>> backgrounds) {
        /* 327 */     log.trace("调用enableRecommended");
        /* 328 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 330 */     mplew.writeShort(SendPacketOpcode.ENABLE_RECOMMENDED.getValue());
        /* 331 */     mplew.write(backgrounds.size());
        /* 332 */     for (Triple<String, Integer, Boolean> background : backgrounds) {
            /* 333 */       mplew.writeMapleAsciiString((String)background.getLeft());
            /* 334 */       mplew.write(((Boolean)background.getRight()).booleanValue() ? Randomizer.nextInt(2) : ((Integer)background.getMid()).intValue());
            /*     */     }
        /* 337 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] sendRecommended(int world, String message) {
        /* 341 */     log.trace("调用sendRecommended");
        /* 342 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 344 */     mplew.writeShort(SendPacketOpcode.SEND_RECOMMENDED.getValue());
        /* 345 */     mplew.write((message != null) ? 1 : 0);
        /* 346 */     if (message != null) {
            /* 347 */       mplew.writeInt(world);
            /* 348 */       mplew.writeMapleAsciiString(message);
            /*     */     }
        /* 351 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getServerList(int serverId, Map<Integer, Integer> channelLoad) {
        /* 362 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 392 */     mplew.writeShort(SendPacketOpcode.SERVERLIST.getValue());
        /* 393 */     mplew.writeShort(ServerConstants.MapleServerName.getValueByOrdinal(ServerConfig.LOGIN_SERVERFLAG));
        /* 394 */     String worldName = LoginServer.getTrueServerName();
        /* 395 */     mplew.writeMapleAsciiString(worldName);
        /* 396 */     mplew.write(ServerConfig.LOGIN_SERVERSTATUS);
        /* 397 */     mplew.writeMapleAsciiString(LoginServer.getEventMessage());
        /* 400 */     mplew.writeZeroBytes(9);
        /* 401 */     int lastChannel = 1;
        /* 402 */     Set<Integer> channels = channelLoad.keySet();
        /* 403 */     for (int i = 30; i > 0; i--) {
            /* 404 */       if (channels.contains(Integer.valueOf(i))) {
                /* 405 */         lastChannel = i;
                /*     */         break;
                /*     */       }
            /*     */     }
        /* 409 */     mplew.write(lastChannel);
        /* 410 */     mplew.writeInt(400);
        /* 412 */     for (int j = 1; j <= lastChannel; j++) {
            /*     */       int load;
            /* 413 */       if (channels.contains(Integer.valueOf(j))) {
                /* 414 */         load = ((Integer)channelLoad.get(Integer.valueOf(j))).intValue();
                /*     */       } else {
                /* 416 */         load = ServerConfig.LOGIN_USERLIMIT;
                /*     */       }
            /* 418 */       mplew.writeMapleAsciiString(worldName + "-" + j);
            /* 419 */       mplew.writeInt((load + ServerConfig.LOGIN_DEFAULTUSERLIMIT) / 10);
            /* 421 */       mplew.write(serverId);
            /* 422 */       mplew.writeShort(j - 1);
            /*     */     }
        /* 425 */     mplew.writeShort(0);
        /* 432 */     mplew.writeInt(0);
        /* 433 */     mplew.write(0);
        /* 434 */     mplew.writeBool(false);
        /* 435 */     int nuk_V170 = -1;
        /* 437 */     if (nuk_V170 != -1) {
            /* 438 */       mplew.write(0);
            /* 439 */       mplew.write(0);
            /* 440 */       mplew.writeMapleAsciiString("");
            /*     */     }
        /* 444 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getEndOfServerList() {
        /* 453 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 460 */     mplew.writeShort(SendPacketOpcode.SERVERLIST.getValue());
        /* 461 */     mplew.writeShort(-1);
        /* 462 */     mplew.writeLong(System.currentTimeMillis());
        /* 463 */     mplew.writeShort(0);
        /* 465 */     int nuk_V170 = -1;
        /* 466 */     mplew.writeInt(nuk_V170);
        /* 467 */     if (nuk_V170 != -1) {
            /* 468 */       mplew.write(0);
            /* 469 */       mplew.write(0);
            /* 470 */       mplew.writeMapleAsciiString("");
            /*     */     }
        /* 473 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getLoginWelcome() {
        /* 477 */     log.trace("调用getLoginWelcome");
        /* 478 */     return MaplePacketCreator.spawnFlags(null);
        /*     */   }
    /*     */
    /*     */   public static byte[] getServerStatus(int status) {
        /* 488 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 496 */     mplew.writeShort(SendPacketOpcode.SERVERSTATUS.getValue());
        /* 497 */     mplew.write(status);
        /* 498 */     mplew.writeInt(0);
        /* 499 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getWorldId(int serverId) {
        /* 503 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 504 */     mplew.writeShort(SendPacketOpcode.LP_WorldIdResult.getValue());
        /* 505 */     mplew.writeBool(false);
        /* 506 */     mplew.writeInt(serverId);
        /* 507 */     mplew.writeInt(0);
        /* 508 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] EventCheck() {
        /* 513 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 515 */     mplew.writeShort(SendPacketOpcode.EVENT_CHECK.getValue());
        /* 516 */     mplew.write(HexTool.getByteArrayFromHexString("00 05 00 00 10 40 00 46 E5 58 00 57 F5 98 00 04 00 00 00 5F F5 98 00 04 00 00 00 6C F5 98 00 94 CA 07 00 D0 C3 A0 00 1C 16 01 00"));
        /* 518 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getChannelSelected() {
        /* 523 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 525 */     mplew.writeShort(SendPacketOpcode.CHANNEL_SELECTED.getValue());
        /* 526 */     mplew.writeInt(3);
        /* 528 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getCharList(String secondpw, List<MapleCharacter> chars, int charslots) {
        /* 540 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 542 */     mplew.writeShort(SendPacketOpcode.CHARLIST.getValue());
        /* 543 */     mplew.write(0);
        /* 544 */     mplew.writeMapleAsciiString("normal");
        /* 545 */     mplew.writeMapleAsciiString("normal");
        /* 546 */     mplew.writeInt(0);
        /* 547 */     mplew.write(0);
        /* 548 */     mplew.write(0);
        /* 549 */     int n3 = 0;
        /*     */     int i;
        /* 550 */     for (i = 0; i <= n3; i++) {
            /* 551 */       mplew.writeInt(n3);
            /* 552 */       mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
            /*     */     }
        /* 554 */     mplew.write(0);
        /* 555 */     mplew.writeInt(chars.size());
        /* 556 */     chars.forEach(chr -> mplew.writeInt(chr.getId()));
        /* 558 */     mplew.write(0);
        /* 559 */     mplew.writeInt(chars.size());
        /* 560 */     mplew.writeInt(0);
        /* 561 */     mplew.write(chars.size());
        /* 562 */     chars.forEach(chr -> addCharEntry(mplew, chr, false));
        /* 564 */     mplew.writeShort(0);
        /* 565 */     mplew.writeLong(charslots);
        /* 566 */     mplew.writeInt(-1);
        /* 567 */     mplew.writeReversedLong(PacketHelper.getTime(System.currentTimeMillis()));
        /* 569 */     mplew.write(0);
        /* 570 */     mplew.write(0);
        /* 571 */     mplew.write(0);
        /* 572 */     mplew.write(0);
        /* 573 */     mplew.write(0);
        /* 574 */     mplew.writeInt(0);
        /* 575 */     mplew.writeInt(0);
        /* 577 */     mplew.writeInt(0);
        /* 578 */     mplew.writeInt(121022127);
        /* 579 */     mplew.write(1);
        /* 580 */     mplew.write(33);
        /* 582 */     for (i = 0; i < ServerConstants.JOB_NAMELIST.length; i++) {
            /* 583 */       mplew.write(ServerConfig.WORLD_CLOSEJOBS.contains(ServerConstants.JOB_NAMELIST[i]) ? 0 : 1);
            /* 584 */       mplew.writeShort(1);
            /*     */     }
        /* 587 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] getCreatCharAuth(MapleClient c) {
        /* 591 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 593 */     mplew.writeShort(SendPacketOpcode.CREAT_CHAR_AUTH.getValue());
        /* 594 */     mplew.write(4);
        /* 596 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] addNewCharEntry(MapleCharacter chr, boolean worked) {
        /* 600 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 602 */     mplew.writeShort(SendPacketOpcode.ADD_NEW_CHAR_ENTRY.getValue());
        /* 603 */     mplew.write(worked ? 0 : 1);
        /* 604 */     addCharEntry(mplew, chr, false);
        /* 606 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] charNameResponse(String charname, boolean nameUsed) {
        /* 610 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 612 */     mplew.writeShort(SendPacketOpcode.CHAR_NAME_RESPONSE.getValue());
        /* 613 */     mplew.writeMapleAsciiString(charname);
        /* 614 */     mplew.write(nameUsed ? 1 : 0);
        /* 616 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] charNameResponse(String charname, byte type) {
        /* 620 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 622 */     mplew.writeShort(SendPacketOpcode.CHAR_NAME_RESPONSE.getValue());
        /* 623 */     mplew.writeMapleAsciiString(charname);
        /* 624 */     mplew.write(type);
        /* 626 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   private static void addCharEntry(MaplePacketLittleEndianWriter mplew, MapleCharacter chr, boolean ranking) {
        /* 630 */     PacketHelper.addCharStats(mplew, chr);
        /* 631 */     mplew.writeInt(0);
        /* 632 */     mplew.writeLong(0L);
        /* 633 */     PacketHelper.addCharLook(mplew, chr, true, chr.isZeroSecondLook());
        /* 634 */     if (JobConstants.is神之子(chr.getJob()))
            /* 635 */       PacketHelper.addCharLook(mplew, chr, true, !chr.isZeroSecondLook());
        /* 637 */     mplew.write(ranking ? 1 : 0);
        /* 638 */     if (ranking) {
            /* 639 */       mplew.writeInt(chr.getRank());
            /* 640 */       mplew.writeInt(chr.getRankMove());
            /* 641 */       mplew.writeInt(chr.getJobRank());
            /* 642 */       mplew.writeInt(chr.getJobRankMove());
            /*     */     }
        /*     */   }
    /*     */
    /*     */   public static byte[] updatePartTimeJob(MaplePartTimeJob partTime) {
        /* 647 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 648 */     mplew.writeShort(SendPacketOpcode.PART_TIME.getValue());
        /* 649 */     mplew.writeInt(partTime.getCharacterId());
        /* 650 */     mplew.write(0);
        /* 651 */     PacketHelper.addPartTimeJob(mplew, partTime);
        /* 652 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] showCharCards(int cards) {
        /* 660 */     log.trace("调用showCharCards");
        /* 661 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 663 */     mplew.writeShort(SendPacketOpcode.SHOW_CHAR_CARDS.getValue());
        /* 664 */     mplew.writeInt(cards);
        /* 666 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] ShowAccCash(int ACash, int mPoints) {
        /* 673 */     log.trace("调用ShowAccCash");
        /* 674 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 676 */     mplew.writeShort(SendPacketOpcode.SHOW_ACC_CASH.getValue());
        /* 677 */     mplew.writeInt(ACash);
        /* 678 */     mplew.writeInt(mPoints);
        /* 680 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] changePlayerKey(String key) {
        /* 684 */     log.trace("调用changePlayerKey");
        /* 685 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 687 */     mplew.writeShort(SendPacketOpcode.LOGIN_AUTHKEY.getValue());
        /* 688 */     mplew.writeMapleAsciiString(key);
        /* 690 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] setVipChannel(String[] channels) {
        /* 694 */     log.trace("调用setVipChannel");
        /* 695 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 696 */     mplew.writeShort(SendPacketOpcode.SET_VIP_CHANNEL.getValue());
        /* 697 */     mplew.writeInt(channels.length);
        /* 698 */     for (String channel : channels) {
            /* 699 */       mplew.writeInt(0);
            /* 700 */       mplew.writeInt(Integer.parseInt(channel) - 1);
            /*     */     }
        /* 703 */     return mplew.getPacket();
        /*     */   }
    /*     */
    /*     */   public static byte[] login_Packet_Debug(byte type) {
        /* 707 */     log.trace("调用login_Packet_Debug");
        /* 708 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        /* 709 */     switch (type) {
            /*     */       case 1:
                /* 711 */         mplew.writeShort(SendPacketOpcode.LOGIN_MESSAGE.getValue());
                /* 712 */         mplew.writeBool(false);
                /* 713 */         mplew.writeMapleAsciiString("你他妈是不是傻？");
                /* 714 */         mplew.writeInt(2);
                /* 715 */         mplew.writeInt(120);
                /* 716 */         mplew.writeInt(2);
                /* 717 */         mplew.writeInt(120);
                /* 718 */         mplew.writeInt(3);
                /* 719 */         return mplew.getPacket();
            /*     */     }
        /* 723 */     return mplew.getPacket();
        /*     */   }
    /*     */ }

